package sebastiankerckhof.scene.material;

import sebastiankerckhof.math.Color3f;
import sebastiankerckhof.math.Vector3f;
import sebastiankerckhof.render.raytrace.Ray;

public class CombiMaterial extends AbstractMaterial{
	private Material material1;
	private Material material2;
	private float weight1;
	private float weight2;

	public CombiMaterial(Material material1, float weight1, Material material2, float weight2) {
		this.material1 = material1;
		this.material2 = material2;
		this.weight1 = weight1;
		this.weight2 = weight2;
	}

	@Override
	public Color3f getShade(Color3f t, Color3f cl, Vector3f l, Vector3f n, Ray r) {
		Color3f color1 = this.material1.getShade(t, cl,l,n,r);
		color1 = color1.multiply(weight1);
		
		Color3f color2 = this.material2.getShade(t, cl,l,n,r);
		color2 = color2.multiply(weight2);
		
		return color1.plus(color2);
	}
}
